package com.itheima.demo1;

public class MathDemo {
    public static void main(String[] args) {
        // 返回参数的绝对值
        int abs = Math.abs(-10);
        System.out.println(abs);
        abs = Math.abs(10);
        System.out.println(abs);

        // 向上取整
        double ceil = Math.ceil(10.1);
        System.out.println(ceil);

        //向下取整
        double floor = Math.floor(10.9);
        System.out.println(floor);

        // 四舍五入
        long round = Math.round(10.1);
        System.out.println(round);

        long round1 = Math.round(1.9);
        System.out.println(round1);

        // 取最大
        int max = Math.max(10, 20);
        System.out.println(max);

        // 取最小
        int min = Math.min(10, 20);
        System.out.println(min);

        // a的b次幂
        double pow = Math.pow(2, 2);
        System.out.println(pow);

        double pow1 = Math.pow(2, 3);
        System.out.println(pow1);

        for (int i = 0; i< 10; i++) {
            double random = Math.random();
            System.out.println(random);
        }
    }
}
